package com.ymatou.apigateway.testcase;

import java.math.BigDecimal;

import org.junit.After;
import org.junit.AfterClass;
import org.junit.Before;
import org.junit.BeforeClass;
import org.junit.Ignore;
import org.junit.Test;
import org.junit.experimental.categories.Category;

import com.shop2cn.iapi.shenqisettlement.parameter.bean.AgentProductBean;
import com.shop2cn.iapi.sqoptrade.resp.TradingServiceResp;
import com.ymatou.apigateway.parameter.AesUtil;
import com.ymatou.apigateway.parameter.OpenApiGetOrderReq;
import com.ymatou.apigateway.parameter.OpenapiReq;
import com.ymatou.apigateway.parameter.resp.OrderInfo;
import com.ymatou.apigateway.parameter.resp.OrderItemInfo;
import com.ymatou.apigateway.service.OpenapiService;
import com.ymatou.apigateway.service.ShenqiGetOrderListCall;
import com.ymatou.common.lang.CipherUtil;
import com.shop2cn.iapi.agentproducts.parameter.ProductDetailsDto;
import com.ymt.core.tool.FormatUtil;
import com.ymt.core.tool.Logger;
import com.ymt.utils.annotation.TestCase;
import com.ymt.utils.tag.P1;
import com.ymttest.business.service.shenqi.DGSQBuildProxyChainCallService;
import com.ymttest.business.service.shenqi.SqTradingCallService;
import com.ymttest.business.service.shenqi.SqTradingProductService;
import com.ymttest.business.service.shenqi.bean.ShenqiUserSet;
import com.ymttest.common.order.userquery.util.Utils;
import com.ymttest.database.model.Application;
import com.ymttest.database.model.AuthCode;
import com.ymttest.database.model.YmtIdCardInfo;
import com.ymttest.database.model.YmtIdCardInfoExample;
import com.ymttest.database.model.sqidcard.IdcardInfo;
import com.ymttest.database.sharding.db.sharding.model.OrderDetailPo;
import com.ymttest.database.sharding.db.sharding.model.OrderPo;
import com.ymttest.database.sharding.db.sharding.model.ShenqiProxyChainPo;
import com.ymttest.database.sharding.db.sqlwapper.OrderShardingWapper;
import com.ymttest.database.sqlwapper.OpenApiWapper;
import com.ymttest.database.sqlwapper.YmtIdCardInfoWapper;
import com.ymttest.database.sqlwapper.sqidcard.IdcardInfoWrapper;
import com.ymttest.utils.DataUtil;
import com.ymttest.utils.EnvSetup;
import com.ymttest.utils.TestDataManager;
import com.ymttest.utils.YMTDateUtil;

public class Ts_sqgetorderdetail {

	private static OpenapiReq openapiReq;
	private static ShenqiGetOrderListCall shenqiGetOrderListCall;
	private static OpenApiWapper openApiWapper;
	private static OpenApiGetOrderReq openApiGetOrderReq;
	
	private static OrderShardingWapper orderShardingWapper = new OrderShardingWapper();
	private static IdcardInfoWrapper idcardInfoWrapper = new IdcardInfoWrapper();
	
	private static long autotest_goodsOwnerId = Long.valueOf(EnvSetup
			.getData("autotest_goodsOwnerId")); 
	private static long multiCDFCodeGoodsOwnerId = ShenqiUserSet.multiCDFCodeGoodsOwnerId;

	@BeforeClass
	public static void setUp() {
		Logger.createResultFile("openapi获取神器订单详情");
		openApiWapper = new OpenApiWapper();
	}

	@Before
	public void caseUp() {

		openapiReq = new OpenapiReq();
		openApiGetOrderReq = new OpenApiGetOrderReq();
		shenqiGetOrderListCall = new ShenqiGetOrderListCall();
		openapiReq.setMethod("sq.order.detail.get");

	}

	@AfterClass
	public static void tearDown() {
		Logger.generateResult(shenqiGetOrderListCall.getOpurl());
	}

	@After
	public void caseDown() {
		Logger.end();
	}
	
	public void verifyRMBPrice(OrderPo orderPo, OrderInfo orderInfo) {
	
		BigDecimal shenqiPaymentRmbAmount = orderPo.getShenqiPaymentRmbAmount();
		BigDecimal exchangeRate = orderPo.getExchangeRate() == null ? BigDecimal.ZERO
				: new BigDecimal(orderPo.getExchangeRate());
		
		DataUtil.verifyDecimalEquals(orderInfo.getRmb_payment(), shenqiPaymentRmbAmount, "验证orderInfo的rmb_payment");
		
		for (OrderItemInfo orderItemInfo : orderInfo.getOrder_items_info()) {
			
			Logger.comment("验证" + orderItemInfo.getSku_id());
			
			OrderDetailPo orderDetailPo = orderShardingWapper
					.selectOrderDetailbyOrderIdAndCatalogId(openApiGetOrderReq.getOrder_id(),
							orderItemInfo.getSku_id());
			
			BigDecimal orderItemRMBShippingFee = orderItemInfo
					.getFree_freight() ? null : orderItemInfo.getShipping_fee()
					.multiply(exchangeRate)
					.setScale(2, BigDecimal.ROUND_HALF_UP);

			BigDecimal orderItemRMBTaxFee = orderItemInfo.getTax_fee()
					.multiply(exchangeRate)
					.multiply(new BigDecimal(orderItemInfo.getNum()))
					.divide(new BigDecimal(orderItemInfo.getNum()))
					.setScale(2, BigDecimal.ROUND_HALF_UP);
			
			Logger.verifyEquals(Utils.falseIfNull(orderDetailPo
					.getFullReductionFreeFreight()), orderItemInfo
					.getFree_freight(), "验证orderItemInfo的free_freight");
			DataUtil.verifyDecimalEquals(orderItemRMBShippingFee,
					orderItemInfo.getRmb_shipping_fee(),
					"验证orderItemInfo的rmb_shipping_fee");
			DataUtil.verifyDecimalEquals(orderItemRMBTaxFee,
					orderItemInfo.getRmb_tax_fee(),
					"验证orderItemInfo的rmb_tax_fee");
		}
	}

	/**
	 * 
	 * @param orderInfo
	 * @param sellerId
	 * @param type
	 * @param isSubProduct （是否包含组合商品）
	 * @throws Exception
	 */
	public void verifyPrice(OrderInfo orderInfo, long sellerId, int type, Boolean isSubProduct) throws Exception {
		
		OrderPo orderPo = orderShardingWapper
				.selectOrderbyOrderId(openApiGetOrderReq.getOrder_id());
		OrderDetailPo detailPo = orderShardingWapper
				.selectOrderDetailbyOrderId(openApiGetOrderReq.getOrder_id())
				.get(0);
		
		String newKey = "123456789";
		OrderItemInfo orderItem = orderInfo.getOrder_items_info().get(0);
		
		ProductDetailsDto productDetailsDto = SqTradingProductService
				.getProductDetails(orderPo.getSellerId(), orderInfo
						.getOrder_items_info().get(0).getProduct_id());
		
		ShenqiProxyChainPo chainPo = null;
		Long idcardId = Utils.zeroIfNull(orderPo.getPurchaserIdcardId());
		
		if (type == 4) {
			
			if (Utils.zeroIfNull(orderPo.getShenqiIdcardRequirement()) == 1
					&& idcardId != 0) {

				IdcardInfo idcardInfo = idcardInfoWrapper.selectByPrimaryKey(idcardId);

				if (null != idcardInfo) {

					Logger.verifyEquals(CipherUtil.decryptAES(newKey,
							idcardInfo.getIdcard_no()), orderInfo.getId_cards()
							.get(0).getReceiver_id_no(), "验证Receiver_id_no");
					Logger.verifyEquals(1, orderInfo.getId_cards().get(0)
							.getReceiver_id_type(), "验证Receiver_id_type");
				} else
					Logger.verifyEquals(null, orderInfo.getId_cards(), "验证Id_cards");
				
			} else if (idcardId == 0) {
				
				YmtIdCardInfoWapper ymtIdCard = new YmtIdCardInfoWapper();
				YmtIdCardInfoExample example = ymtIdCard.getYmtIdCardInfoExample();
				
				example.createCriteria().andBuyeridEqualTo(20238699)
						.andNameEqualTo("testUser");
				
				YmtIdCardInfo record = new YmtIdCardInfo();
				record.setStatus(1);
				
				ymtIdCard.update(record, example);

				YmtIdCardInfo ymtIdCardInfo = ymtIdCard.selectByNameAndBuyerId(
						orderInfo.getReceiver_name(), orderPo.getUserId());
				
				if (null != ymtIdCardInfo) {
					
					Logger.verifyEquals(
							CipherUtil.decryptAES("1234567890123456", ymtIdCardInfo.getIDCard()),
							orderInfo.getId_cards().get(0).getReceiver_id_no(),
							"验证Receiver_id_no");
					Logger.verifyEquals(ymtIdCardInfo.getCardType(), orderInfo
							.getId_cards().get(0).getReceiver_id_type(),
							"验证Receiver_id_type");
				} else
					Logger.verifyEquals(null, orderInfo.getId_cards(), "验证Id_cards");
			}
		}
		
		// 如果是自采商品
		if (productDetailsDto.getAgentType() == 0) {
			
			chainPo = new ShenqiProxyChainPo();
			
			chainPo.setFromParentPrice(BigDecimal.ZERO);
		} else {
			
			chainPo = SqTradingProductService
					.getProxyChainInfo(orderItem.getSku_id(), sellerId);
		}

		switch (type) {
		case 1:
			DataUtil.verifyDecimalEquals(
					detailPo.getProductPrice().add(
							Utils.zeroIfNull(detailPo
									.getBookingPromotionAmount())), orderItem
							.getPrice(), "校验price");
			DataUtil.verifyDecimalEquals(BigDecimal.ZERO,
					orderItem.getVendor_price(), "校验vendor_price");
			break;
		case 2:
			DataUtil.verifyDecimalEquals(chainPo.getToChildPrice(),
					orderItem.getPrice(), "校验price");
			DataUtil.verifyDecimalEquals(chainPo.getFromParentPrice(),
					orderItem.getVendor_price(), "校验vendor_price");
			break;
		case 3:

			DataUtil.verifyDecimalEquals(
					detailPo.getProductPrice().add(
							Utils.zeroIfNull(detailPo
									.getBookingPromotionAmount())), orderItem
							.getPrice(), "校验price");
			DataUtil.verifyDecimalEquals(chainPo.getFromParentPrice(),
					orderItem.getVendor_price(), "校验vendor_price");
			this.verifyRMBPrice(orderPo, orderInfo);

			break;
		default:
			DataUtil.verifyDecimalEquals(
					detailPo.getProductPrice().add(
							Utils.zeroIfNull(detailPo
									.getBookingPromotionAmount())), orderItem
							.getPrice(), "校验price");
			DataUtil.verifyDecimalEquals(BigDecimal.ZERO,
					orderItem.getVendor_price(), "校验vendor_price");
		}
		
		Logger.verifyEquals(orderPo.getWarehouseId(), orderInfo.getWarehouse_id(), "验证Warehouse_id");
	}

	@SuppressWarnings("static-access")
	@Test
	@Category({ P1.class })
	@TestCase
	public void Tc_sqgetorderdetail_001() {
		Logger.start(true, "openapi店主获取订单详情 指定orderid");
		try {
			
			long orderId = 14129398699L;

			long sellerId = 500041475;

			openApiGetOrderReq.setOrder_id(orderId);

			Application application = openApiWapper
					.selectApplicationBySellerId(sellerId).get(0);

			String app_id = application.getApp_id();

			AuthCode authCode = openApiWapper.selectAuthCodeByAppId(app_id)
					.get(0);

			openapiReq.setApp_id(app_id);

			String app_secret = application.getApp_secret();

			openapiReq.setSign_method("MD5");
			openapiReq.setAuth_code(authCode.getAuth_code());
			openapiReq.setTimestamp(YMTDateUtil.getSysTime());
			openapiReq.setNonce_str(TestDataManager.getRandomNum(31));
			openapiReq.setBiz_content(new FormatUtil()
					.beanToGSONString(openApiGetOrderReq));
			String url = String
					.format("http://apigateway.shop2cn.com/apigateway/v1?app_id=%s&method=sq.order.detail.get",
							app_id);

			shenqiGetOrderListCall.setUrl(url);

			openapiReq.setSign(OpenapiService.generateMD5(openapiReq,
					AesUtil.decrypt(app_secret)));

			shenqiGetOrderListCall.setData(openapiReq);

			shenqiGetOrderListCall.callService();

			Logger.verifyEquals("0000", shenqiGetOrderListCall.getCode(), 
					"校验code");
			Logger.verifyEquals("", shenqiGetOrderListCall.getMsg(),
					"校验message");

			Logger.verifyNotNull(shenqiGetOrderListCall.getContent(),
					"校验content");

			this.verifyPrice(shenqiGetOrderListCall.getorderdetailResponse()
					.getOrderInfo(), sellerId, 3, false);

		} catch (Exception e) {
			Logger.fail(e);
		}
	}
	
	@SuppressWarnings("static-access")
	@Test
	@Category({ P1.class })
	@TestCase
	public void Tc_sqgetorderdetail_002() {
		Logger.start(true, "openapi中间商获取订单详情 指定orderid");
		try {

			long orderId = 1420039407;

			long sellerId = 500811132;

			openApiGetOrderReq.setOrder_id(orderId);

			Application application = openApiWapper
					.selectApplicationBySellerId(sellerId).get(0);

			String app_id = application.getApp_id();

			AuthCode authCode = openApiWapper.selectAuthCodeByAppId(app_id)
					.get(0);

			openapiReq.setApp_id(app_id);

			String app_secret = application.getApp_secret();

			openapiReq.setSign_method("MD5");
			openapiReq.setAuth_code(authCode.getAuth_code());
			openapiReq.setTimestamp(YMTDateUtil.getSysTime());
			openapiReq.setNonce_str(TestDataManager.getRandomNum(31));
			openapiReq.setBiz_content(new FormatUtil()
					.beanToGSONString(openApiGetOrderReq));
			String url = String
					.format("http://apigateway.shop2cn.com/apigateway/v1?app_id=%s&method=sq.order.detail.get",
							app_id);

			shenqiGetOrderListCall.setUrl(url);

			openapiReq.setSign(OpenapiService.generateMD5(openapiReq,
					AesUtil.decrypt(app_secret)));

			shenqiGetOrderListCall.setData(openapiReq);

			shenqiGetOrderListCall.callService();

			Logger.verifyEquals("0000", shenqiGetOrderListCall.getCode(),
					"校验code");
			Logger.verifyEquals("", shenqiGetOrderListCall.getMsg(),
					"校验message");

			Logger.verifyNotNull(shenqiGetOrderListCall.getContent(),
					"校验content");

			this.verifyPrice(shenqiGetOrderListCall.getorderdetailResponse()
					.getOrderInfo(), sellerId, 2, null);

		} catch (Exception e) {
			Logger.fail(e);
		}
	}

	@SuppressWarnings("static-access")
	@Test
	@Category({ P1.class })
	@TestCase
	public void Tc_sqgetorderdetail_004() {
		Logger.start(true, "openapi直销商，订单发货后，获取订单详情");
		try {
			
//			AgentProductBean productBean = DGSQBuildProxyChainCallService
//					.createProxychain((int) autotest_goodsOwnerId, 0, false, true);
//			String currency = productBean.getCurrency();
//			
//			PlaceOrderReq placeOrderReq = TradingForDGSQCallService
//					.buildDGSQStandPlaceOrderReq(1234L, BigDecimal.ZERO, 20238699,
//							productBean, autotest_goodsOwnerId);
//			
//			placeOrderReq.setUserId(20238699);
//			
//			placeOrderReq.getOrderGroups().get(0).setServiceRate(BigDecimal.TEN);
//			placeOrderReq.getOrderGroups().get(0).getOrders().get(0)
//					.getOrderItems().get(0)
//					.setProdTaxRate(new BigDecimal("0.17"));
//
//			OrderItemVo orderItem = TradingForDGSQCallService
//					.createOrderItemVo(productBean.getProductId(), productBean
//							.getCatalogList().get(1));
//			orderItem.setProdTaxRate(new BigDecimal("0.13"));
//			
//			placeOrderReq.getOrderGroups().get(0).getOrders().get(0)
//					.getOrderItems().add(orderItem);
//			
//			placeOrderReq.setCurrency(currency);
//			placeOrderReq.getOrderGroups().get(0).getOrders().get(0)
//					.setWarehouseId(214123);
//			
//			TradingServiceResp placeOrder = TradingForDGSQCallService
//					.callPlaceOrderService(placeOrderReq);
//
//			Long thirdTradingId = TradingForDGSQCallService.payOrder(
//					placeOrder.getUserId(), placeOrder.getMainOrderId());
//
//			Thread.sleep(3000);
//
//			// 支付网关支付回调交易
//			SQPayGateWayCallService.DGSQNotifyCall(
//					String.valueOf(thirdTradingId), placeOrder
//							.getPayableAmount().subtract(BigDecimal.ZERO)
//							.toString(), (int) placeOrder.getUserId(),
//					BigDecimal.ZERO.toPlainString(), currency);
//			
//			Thread.sleep(5000);
			
//			long orderId = placeOrder.getOrderList().get(0).getOrderId();
//			long sellerId = autotest_goodsOwnerId;
			
			long orderId = 1481750783L;
			long sellerId = 502060981L;
			
//			TradingForDGSQCallService.sellerAcceptOrder(orderId);
//			
//			TradingForDGSQCallService.delivery(autotest_goodsOwnerId, orderId, 1234L, null);
			
			openApiGetOrderReq.setOrder_id(orderId);
			openApiGetOrderReq.setNeeds_delivery_info(true);

			Logger.comment("userid:" + sellerId);
			Application application = openApiWapper
					.selectApplicationBySellerId(Long.valueOf(sellerId)).get(0);

			String app_id = application.getApp_id();

			AuthCode authCode = openApiWapper.selectAuthCodeByAppId(app_id)
					.get(0);

			openapiReq.setApp_id(app_id);

			String app_secret = application.getApp_secret();

			openapiReq.setSign_method("MD5");
			openapiReq.setAuth_code(authCode.getAuth_code());
			openapiReq.setTimestamp(YMTDateUtil.getSysTime());
			openapiReq.setNonce_str(TestDataManager.getRandomNum(31));
			openapiReq.setBiz_content(new FormatUtil()
					.beanToGSONString(openApiGetOrderReq));

			String url = String
					.format("http://apigateway.shop2cn.com/apigateway/v1?app_id=%s&method=sq.order.detail.get",
							app_id);

			shenqiGetOrderListCall.setUrl(url);

			openapiReq.setSign(OpenapiService.generateMD5(openapiReq,
					AesUtil.decrypt(app_secret)));

			shenqiGetOrderListCall.setData(openapiReq);

			shenqiGetOrderListCall.callService();

			Logger.verifyEquals("0000", shenqiGetOrderListCall.getCode(), "校验code");
			Logger.verifyEquals("", shenqiGetOrderListCall.getMsg(),
					"校验message");

			Logger.verifyNotNull(shenqiGetOrderListCall.getContent(), "校验content");
			
			this.verifyPrice(shenqiGetOrderListCall.getorderdetailResponse()
					.getOrderInfo(), sellerId, 4, null);

		} catch (Exception e) {
			Logger.fail(e);
		}
	}

	@SuppressWarnings("static-access")
	@Test
	@Category({ P1.class })
	@TestCase
	public void Tc_sqgetorderdetail_006() {
		Logger.start(true, "openapi获取订单详情,该订单不是买手的订单");
		try {

			/*
			 * PlaceOrderResp placeOrderResp = PlaceOrderService
			 * .placeOrderWithOutCoupon();
			 * 
			 * int sellerId =
			 * placeOrderResp.getOrderList().get(0).getSellerId(); int orderId =
			 * placeOrderResp.getOrderList().get(0).getOrderId();
			 */
			openApiGetOrderReq.setOrder_id(3746038699L);

			Application application = openApiWapper
					.selectApplicationBySellerId(3383L).get(0);

			String app_id = application.getApp_id();

			AuthCode authCode = openApiWapper.selectAuthCodeByAppId(app_id)
					.get(0);

			openapiReq.setApp_id(app_id);

			String app_secret = application.getApp_secret();

			openapiReq.setSign_method("MD5");
			openapiReq.setAuth_code(authCode.getAuth_code());
			openapiReq.setTimestamp(YMTDateUtil.getSysTime());
			openapiReq.setNonce_str(TestDataManager.getRandomNum(31));
			openapiReq.setBiz_content(new FormatUtil()
					.beanToGSONString(openApiGetOrderReq));
			String url = String
					.format("http://apigateway.shop2cn.com/apigateway/v1?app_id=%s&method=sq.order.detail.get",
							app_id);

			shenqiGetOrderListCall.setUrl(url);

			openapiReq.setSign(OpenapiService.generateMD5(openapiReq,
					AesUtil.decrypt(app_secret)));

			shenqiGetOrderListCall.setData(openapiReq);

			shenqiGetOrderListCall.callService();

			Logger.verifyEquals("0000", shenqiGetOrderListCall.getCode(), "校验code");
			Logger.verifyEquals("", shenqiGetOrderListCall.getMsg(),
					"校验message");

			DataUtil.verify(null,
					shenqiGetOrderListCall.getContent().get("order_info"),
					"校验content");

		} catch (Exception e) {
			Logger.fail(e);
		}
	}

	@SuppressWarnings("static-access")
	@Test
	@Category({ P1.class })
	@TestCase
	public void Tc_sqgetorderdetail_007() {
		Logger.start(true, "openapi获取订单详情,订单号不存在");
		try {

			/*
			 * PlaceOrderResp placeOrderResp = PlaceOrderService
			 * .placeOrderWithOutCoupon();
			 * 
			 * int sellerId =
			 * placeOrderResp.getOrderList().get(0).getSellerId(); int orderId =
			 * placeOrderResp.getOrderList().get(0).getOrderId();
			 */
			openApiGetOrderReq.setOrder_id(11111111);

			Application application = openApiWapper
					.selectApplicationBySellerId(3383L).get(0);

			String app_id = application.getApp_id();

			AuthCode authCode = openApiWapper.selectAuthCodeByAppId(app_id)
					.get(0);

			openapiReq.setApp_id(app_id);

			String app_secret = application.getApp_secret();

			openapiReq.setSign_method("MD5");
			openapiReq.setAuth_code(authCode.getAuth_code());
			openapiReq.setTimestamp(YMTDateUtil.getSysTime());
			openapiReq.setNonce_str(TestDataManager.getRandomNum(31));
			openapiReq.setBiz_content(new FormatUtil()
					.beanToGSONString(openApiGetOrderReq));
			String url = String
					.format("http://apigateway.shop2cn.com/apigateway/v1?app_id=%s&method=sq.order.detail.get",
							app_id);

			shenqiGetOrderListCall.setUrl(url);

			openapiReq.setSign(OpenapiService.generateMD5(openapiReq,
					AesUtil.decrypt(app_secret)));

			shenqiGetOrderListCall.setData(openapiReq);

			shenqiGetOrderListCall.callService();

			Logger.verifyEquals("0000", shenqiGetOrderListCall.getCode(), "校验code");
			Logger.verifyEquals("", shenqiGetOrderListCall.getMsg(),
					"校验message");

			DataUtil.verify(null,
					shenqiGetOrderListCall.getContent().get("order_info"),
					"校验content");

		} catch (Exception e) {
			Logger.fail(e);
		}
	}

	@SuppressWarnings("static-access")
	@Test
	@Category({ P1.class })
	@TestCase
	public void Tc_sqgetorderdetail_008() {
		Logger.start(true, "openapi获取订单详情,订单号为null");
		try {

			/*
			 * PlaceOrderResp placeOrderResp = PlaceOrderService
			 * .placeOrderWithOutCoupon();
			 * 
			 * int sellerId =
			 * placeOrderResp.getOrderList().get(0).getSellerId(); int orderId =
			 * placeOrderResp.getOrderList().get(0).getOrderId();
			 */
			// openApiGetOrderReq.setOrder_id(11111111);

			Application application = openApiWapper
					.selectApplicationBySellerId(500004881L).get(0);

			String app_id = application.getApp_id();

			AuthCode authCode = openApiWapper.selectAuthCodeByAppId(app_id)
					.get(0);

			openapiReq.setApp_id(app_id);

			String app_secret = application.getApp_secret();

			openapiReq.setSign_method("MD5");
			openapiReq.setAuth_code(authCode.getAuth_code());
			openapiReq.setTimestamp(YMTDateUtil.getSysTime());
			openapiReq.setNonce_str(TestDataManager.getRandomNum(31));
			openapiReq.setBiz_content(new FormatUtil()
					.beanToGSONString(openApiGetOrderReq));
			String url = String
					.format("http://apigateway.shop2cn.com/apigateway/v1?app_id=%s&method=sq.order.detail.get",
							app_id);

			shenqiGetOrderListCall.setUrl(url);

			openapiReq.setSign(OpenapiService.generateMD5(openapiReq,
					AesUtil.decrypt(app_secret)));

			shenqiGetOrderListCall.setData(openapiReq);

			shenqiGetOrderListCall.callService();

			Logger.verifyEquals("0001", shenqiGetOrderListCall.getCode(), "校验code");
			Logger.verifyEquals("orderId:订单ID非法", shenqiGetOrderListCall.getMsg(),
					"校验message");

			Logger.verifyIsNull(shenqiGetOrderListCall.getContent(), "校验content");

		} catch (Exception e) {
			Logger.fail(e);
		}
	}

	@SuppressWarnings("static-access")
	@Test
	@Category({ P1.class })
	@TestCase
	public void Tc_sqgetorderdetail_009() {
		Logger.start(true, "openapi获取订单详情,订单为已接单");
		try {

			long orderId = 12979788699L;
			
//			long orderId = 1590011256;

			long sellerId = 500002490;

			openApiGetOrderReq.setOrder_id(orderId);

			Application application = openApiWapper
					.selectApplicationBySellerId(Long.valueOf(sellerId)).get(0);

			String app_id = application.getApp_id();

			AuthCode authCode = openApiWapper.selectAuthCodeByAppId(app_id)
					.get(0);

			openapiReq.setApp_id(app_id);

			String app_secret = application.getApp_secret();

			openapiReq.setSign_method("MD5");
			openapiReq.setAuth_code(authCode.getAuth_code());
			openapiReq.setTimestamp(YMTDateUtil.getSysTime());
			openapiReq.setNonce_str(TestDataManager.getRandomNum(31));
			openapiReq.setBiz_content(new FormatUtil()
					.beanToGSONString(openApiGetOrderReq));
			String url = String
					.format("http://apigateway.shop2cn.com/apigateway/v1?app_id=%s&method=sq.order.detail.get",
							app_id);

			shenqiGetOrderListCall.setUrl(url);

			openapiReq.setSign(OpenapiService.generateMD5(openapiReq,
					AesUtil.decrypt(app_secret)));

			shenqiGetOrderListCall.setData(openapiReq);

			shenqiGetOrderListCall.callService();

			Logger.verifyEquals("0000", shenqiGetOrderListCall.getCode(), "校验code");
			Logger.verifyEquals("", shenqiGetOrderListCall.getMsg(),
					"校验message");

			Logger.verifyNotNull(shenqiGetOrderListCall.getContent(), "校验content");
			
			this.verifyPrice(shenqiGetOrderListCall.getorderdetailResponse()
					.getOrderInfo(), sellerId, 3, false);

		} catch (Exception e) {
			Logger.fail(e);
		}
	}

	@SuppressWarnings("static-access")
	@Test
	@Category({ P1.class })
	@TestCase
	public void Tc_sqgetorderdetail_012() {
		Logger.start(true, "openapi货头获取订单详情 指定orderid");
		try {

			long orderId = 14129388699L;

			long sellerId = autotest_goodsOwnerId;

			openApiGetOrderReq.setOrder_id(orderId);

			Application application = openApiWapper
					.selectApplicationBySellerId(sellerId).get(0);

			String app_id = application.getApp_id();

			AuthCode authCode = openApiWapper.selectAuthCodeByAppId(app_id)
					.get(0);

			openapiReq.setApp_id(app_id);

			String app_secret = application.getApp_secret();

			openapiReq.setSign_method("MD5");
			openapiReq.setAuth_code(authCode.getAuth_code());
			openapiReq.setTimestamp(YMTDateUtil.getSysTime());
			openapiReq.setNonce_str(TestDataManager.getRandomNum(31));
			openapiReq.setBiz_content(new FormatUtil()
					.beanToGSONString(openApiGetOrderReq));
			String url = String
					.format("http://apigateway.shop2cn.com/apigateway/v1?app_id=%s&method=sq.order.detail.get",
							app_id);

			shenqiGetOrderListCall.setUrl(url);

			openapiReq.setSign(OpenapiService.generateMD5(openapiReq,
					AesUtil.decrypt(app_secret)));

			shenqiGetOrderListCall.setData(openapiReq);

			shenqiGetOrderListCall.callService();

			Logger.verifyEquals("0000", shenqiGetOrderListCall.getCode(),
					"校验code");
			Logger.verifyEquals("", shenqiGetOrderListCall.getMsg(),
					"校验message");

			Logger.verifyNotNull(shenqiGetOrderListCall.getContent(),
					"校验content");

			this.verifyPrice(shenqiGetOrderListCall.getorderdetailResponse()
					.getOrderInfo(), sellerId, 3, false);

		} catch (Exception e) {
			Logger.fail(e);
		}
	}
	
	@SuppressWarnings("static-access")
	@Test
	@Category({ P1.class })
	@TestCase
	public void Tc_sqgetorderdetail_013() {
		Logger.start(true, "openapi货头获取订单详情 purchaserIdcardId没有身份证信息");
		try {

//			AgentProductBean productBean = DGSQBuildProxyChainCallService
//					.createProxychain((int) autotest_goodsOwnerId, 0, false);
//
//			TradingServiceResp placeOrder = TradingForDGSQCallService
//					.placeOrderWithPurchaserIdcardId(productBean,
//							(long) TestDataManager.getRandomIntNum(20));
			
			long orderId = 12954178699L;
			long sellerId = autotest_goodsOwnerId;

			openApiGetOrderReq.setOrder_id(orderId);

			Application application = openApiWapper
					.selectApplicationBySellerId(sellerId).get(0);

			String app_id = application.getApp_id();

			AuthCode authCode = openApiWapper.selectAuthCodeByAppId(app_id)
					.get(0);

			openapiReq.setApp_id(app_id);

			String app_secret = application.getApp_secret();

			openapiReq.setSign_method("MD5");
			openapiReq.setAuth_code(authCode.getAuth_code());
			openapiReq.setTimestamp(YMTDateUtil.getSysTime());
			openapiReq.setNonce_str(TestDataManager.getRandomNum(31));
			openapiReq.setBiz_content(new FormatUtil()
					.beanToGSONString(openApiGetOrderReq));
			String url = String
					.format("http://apigateway.shop2cn.com/apigateway/v1?app_id=%s&method=sq.order.detail.get",
							app_id);

			shenqiGetOrderListCall.setUrl(url);

			openapiReq.setSign(OpenapiService.generateMD5(openapiReq,
					AesUtil.decrypt(app_secret)));

			shenqiGetOrderListCall.setData(openapiReq);

			shenqiGetOrderListCall.callService();

			Logger.verifyEquals("0000", shenqiGetOrderListCall.getCode(),
					"校验code");
			Logger.verifyEquals("", shenqiGetOrderListCall.getMsg(),
					"校验message");

			Logger.verifyNotNull(shenqiGetOrderListCall.getContent(),
					"校验content");

			this.verifyPrice(shenqiGetOrderListCall.getorderdetailResponse()
					.getOrderInfo(), sellerId, 4, false);

		} catch (Exception e) {
			Logger.fail(e);
		}
	}
	
	@SuppressWarnings("static-access")
	@Test
	@Category({ P1.class })
	@TestCase
	public void Tc_sqgetorderdetail_014() {
		Logger.start(true, "openapi货头获取订单详情 purchaserIdcardId有身份证信息");
		try {

//			AgentProductBean productBean = DGSQBuildProxyChainCallService
//					.createProxychain((int) autotest_goodsOwnerId, 0, false);
//
//			TradingServiceResp placeOrder = TradingForDGSQCallService
//					.placeOrderWithPurchaserIdcardId(productBean,
//							2L);
			
			long orderId = 12958618699L;
			long sellerId = autotest_goodsOwnerId;

			openApiGetOrderReq.setOrder_id(orderId);

			Application application = openApiWapper
					.selectApplicationBySellerId(sellerId).get(0);

			String app_id = application.getApp_id();

			AuthCode authCode = openApiWapper.selectAuthCodeByAppId(app_id)
					.get(0);

			openapiReq.setApp_id(app_id);

			String app_secret = application.getApp_secret();

			openapiReq.setSign_method("MD5");
			openapiReq.setAuth_code(authCode.getAuth_code());
			openapiReq.setTimestamp(YMTDateUtil.getSysTime());
			openapiReq.setNonce_str(TestDataManager.getRandomNum(31));
			openapiReq.setBiz_content(new FormatUtil()
					.beanToGSONString(openApiGetOrderReq));
			String url = String
					.format("http://apigateway.shop2cn.com/apigateway/v1?app_id=%s&method=sq.order.detail.get",
							app_id);

			shenqiGetOrderListCall.setUrl(url);

			openapiReq.setSign(OpenapiService.generateMD5(openapiReq,
					AesUtil.decrypt(app_secret)));

			shenqiGetOrderListCall.setData(openapiReq);

			shenqiGetOrderListCall.callService();

			Logger.verifyEquals("0000", shenqiGetOrderListCall.getCode(),
					"校验code");
			Logger.verifyEquals("", shenqiGetOrderListCall.getMsg(),
					"校验message");

			Logger.verifyNotNull(shenqiGetOrderListCall.getContent(),
					"校验content");

			this.verifyPrice(shenqiGetOrderListCall.getorderdetailResponse()
					.getOrderInfo(), sellerId, 4, false);

		} catch (Exception e) {
			Logger.fail(e);
		}
	}
	
	@SuppressWarnings("static-access")
	@Test
	@Category({ P1.class })
	@TestCase
	public void Tc_sqgetorderdetail_015() {
		Logger.start(true, "openapi直销商获取虚拟库存订单详情");
		try {
			
			// 创建订单
			Logger.comment("前置数据准备");
			
			long orderId = 10829938699L;
			long sellerId = autotest_goodsOwnerId;

			openApiGetOrderReq.setOrder_id(orderId);

			Logger.comment("userid:" + sellerId);
			Application application = openApiWapper
					.selectApplicationBySellerId(Long.valueOf(sellerId)).get(0);

			String app_id = application.getApp_id();

			AuthCode authCode = openApiWapper.selectAuthCodeByAppId(app_id)
					.get(0);

			openapiReq.setApp_id(app_id);

			String app_secret = application.getApp_secret();

			openapiReq.setSign_method("MD5");
			openapiReq.setAuth_code(authCode.getAuth_code());
			openapiReq.setTimestamp(YMTDateUtil.getSysTime());
			openapiReq.setNonce_str(TestDataManager.getRandomNum(31));
			openapiReq.setBiz_content(new FormatUtil()
					.beanToGSONString(openApiGetOrderReq));
			String url = String
					.format("http://apigateway.shop2cn.com/apigateway/v1?app_id=%s&method=sq.order.detail.get",
							app_id);

			shenqiGetOrderListCall.setUrl(url);

			openapiReq.setSign(OpenapiService.generateMD5(openapiReq,
					AesUtil.decrypt(app_secret)));

			shenqiGetOrderListCall.setData(openapiReq);

			shenqiGetOrderListCall.callService();

			Logger.verifyEquals("0000", shenqiGetOrderListCall.getCode(), "校验code");
			Logger.verifyEquals("", shenqiGetOrderListCall.getMsg(),
					"校验message");

			Logger.verifyNotNull(shenqiGetOrderListCall.getContent(), "校验content");
			
			this.verifyPrice(shenqiGetOrderListCall.getorderdetailResponse()
					.getOrderInfo(), sellerId, 4, false);

		} catch (Exception e) {
			Logger.fail(e);
		}
	}
	
	@SuppressWarnings("static-access")
	@Test
	@Category({ P1.class })
	@TestCase
	public void Tc_sqgetorderdetail_016() {
		Logger.start(true, "openapi直销商，获取组合商品订单详情");
		try {
			
			long orderId = 13548378699L;
			
			long sellerId = autotest_goodsOwnerId;
			
			openApiGetOrderReq.setOrder_id(orderId);
			openApiGetOrderReq.setNeeds_delivery_info(true);

			Logger.comment("userid:" + sellerId);
			Application application = openApiWapper
					.selectApplicationBySellerId(Long.valueOf(sellerId)).get(0);

			String app_id = application.getApp_id();

			AuthCode authCode = openApiWapper.selectAuthCodeByAppId(app_id)
					.get(0);

			openapiReq.setApp_id(app_id);

			String app_secret = application.getApp_secret();

			openapiReq.setSign_method("MD5");
			openapiReq.setAuth_code(authCode.getAuth_code());
			openapiReq.setTimestamp(YMTDateUtil.getSysTime());
			openapiReq.setNonce_str(TestDataManager.getRandomNum(31));
			openapiReq.setBiz_content(new FormatUtil()
					.beanToGSONString(openApiGetOrderReq));

			String url = String
					.format("http://apigateway.shop2cn.com/apigateway/v1?app_id=%s&method=sq.order.detail.get",
							app_id);

			shenqiGetOrderListCall.setUrl(url);

			openapiReq.setSign(OpenapiService.generateMD5(openapiReq,
					AesUtil.decrypt(app_secret)));

			shenqiGetOrderListCall.setData(openapiReq);

			shenqiGetOrderListCall.callService();

			Logger.verifyEquals("0000", shenqiGetOrderListCall.getCode(), "校验code");
			Logger.verifyEquals("", shenqiGetOrderListCall.getMsg(),
					"校验message");

			Logger.verifyNotNull(shenqiGetOrderListCall.getContent(), "校验content");

		} catch (Exception e) {
			Logger.fail(e);
		}
	}
	
	@SuppressWarnings("static-access")
	@Test
	@Category({ P1.class })
	@TestCase
	public void Tc_sqgetorderdetail_017() {
		Logger.start(true, "openapi直销商，获取组合商品订单详情带积分");
		try {
			
//			long orderId = 11877948699L;
			long orderId = 1560810783L;
			
			long sellerId = 502060981;
			
			openApiGetOrderReq.setOrder_id(orderId);
			openApiGetOrderReq.setNeeds_delivery_info(true);

			Logger.comment("userid:" + sellerId);
			Application application = openApiWapper
					.selectApplicationBySellerId(Long.valueOf(sellerId)).get(0);

			String app_id = application.getApp_id();

			AuthCode authCode = openApiWapper.selectAuthCodeByAppId(app_id)
					.get(0);

			openapiReq.setApp_id(app_id);

			String app_secret = application.getApp_secret();

			openapiReq.setSign_method("MD5");
			openapiReq.setAuth_code(authCode.getAuth_code());
			openapiReq.setTimestamp(YMTDateUtil.getSysTime());
			openapiReq.setNonce_str(TestDataManager.getRandomNum(31));
			openapiReq.setBiz_content(new FormatUtil()
					.beanToGSONString(openApiGetOrderReq));

			String url = String
					.format("http://apigateway.shop2cn.com/apigateway/v1?app_id=%s&method=sq.order.detail.get",
							app_id);

			shenqiGetOrderListCall.setUrl(url);

			openapiReq.setSign(OpenapiService.generateMD5(openapiReq,
					AesUtil.decrypt(app_secret)));

			shenqiGetOrderListCall.setData(openapiReq);

			shenqiGetOrderListCall.callService();

			Logger.verifyEquals("0000", shenqiGetOrderListCall.getCode(), "校验code");
			Logger.verifyEquals("", shenqiGetOrderListCall.getMsg(),
					"校验message");

			Logger.verifyNotNull(shenqiGetOrderListCall.getContent(), "校验content");

		} catch (Exception e) {
			Logger.fail(e);
		}
	}
	
	@SuppressWarnings("static-access")
	@Test
	@Category({ P1.class })
	@TestCase
	public void Tc_sqgetorderdetail_018() {
		Logger.start(true, "openapi获取分销员订单详情");
		try {
			
//			long orderId = 1440018437L;
//			
//			long sellerId = 502038435;
			
			long orderId = 1470037143L;
			
			long sellerId = 500041475;
			
			openApiGetOrderReq.setOrder_id(orderId);
			openApiGetOrderReq.setNeeds_delivery_info(true);

			Logger.comment("userid:" + sellerId);
			Application application = openApiWapper
					.selectApplicationBySellerId(Long.valueOf(sellerId)).get(0);

			String app_id = application.getApp_id();

			AuthCode authCode = openApiWapper.selectAuthCodeByAppId(app_id)
					.get(0);

			openapiReq.setApp_id(app_id);

			String app_secret = application.getApp_secret();

			openapiReq.setSign_method("MD5");
			openapiReq.setAuth_code(authCode.getAuth_code());
			openapiReq.setTimestamp(YMTDateUtil.getSysTime());
			openapiReq.setNonce_str(TestDataManager.getRandomNum(31));
			openapiReq.setBiz_content(new FormatUtil()
					.beanToGSONString(openApiGetOrderReq));

			String url = String
					.format("http://apigateway.shop2cn.com/apigateway/v1?app_id=%s&method=sq.order.detail.get",
							app_id);

			shenqiGetOrderListCall.setUrl(url);

			openapiReq.setSign(OpenapiService.generateMD5(openapiReq,
					AesUtil.decrypt(app_secret)));

			shenqiGetOrderListCall.setData(openapiReq);

			shenqiGetOrderListCall.callService();

			Logger.verifyEquals("0000", shenqiGetOrderListCall.getCode(), "校验code");
			Logger.verifyEquals("", shenqiGetOrderListCall.getMsg(),
					"校验message");

			Logger.verifyNotNull(shenqiGetOrderListCall.getContent(), "校验content");

		} catch (Exception e) {
			Logger.fail(e);
		}
	}
	
	@SuppressWarnings("static-access")
	@Test
	@Category({ P1.class })
	@TestCase
	public void Tc_sqgetorderdetail_019() {
		Logger.start(true, "openapi获取一品多码订单详情");
		try {
			
			AgentProductBean productBean = DGSQBuildProxyChainCallService
					.createMultiCodeProxychain((int) multiCDFCodeGoodsOwnerId,
							false);

			TradingServiceResp placeOrderResp = SqTradingCallService
					.placeMultiCDFCodeOrder(productBean,
							multiCDFCodeGoodsOwnerId);
			
			OrderPo order = placeOrderResp.getOrderList().get(0).getOrderPo();

			long orderId = order.getOrderId();
			
//			long orderId = 1560070783L;
			
			openApiGetOrderReq.setOrder_id(orderId);
			openApiGetOrderReq.setNeeds_delivery_info(true);

			Logger.comment("userid:" + multiCDFCodeGoodsOwnerId);
			Application application = openApiWapper
					.selectApplicationBySellerId(Long.valueOf(multiCDFCodeGoodsOwnerId)).get(0);

			String app_id = application.getApp_id();

			AuthCode authCode = openApiWapper.selectAuthCodeByAppId(app_id)
					.get(0);

			openapiReq.setApp_id(app_id);

			String app_secret = application.getApp_secret();

			openapiReq.setSign_method("MD5");
			openapiReq.setAuth_code(authCode.getAuth_code());
			openapiReq.setTimestamp(YMTDateUtil.getSysTime());
			openapiReq.setNonce_str(TestDataManager.getRandomNum(31));
			openapiReq.setBiz_content(new FormatUtil()
					.beanToGSONString(openApiGetOrderReq));

			String url = String
					.format("http://apigateway.shop2cn.com/apigateway/v1?app_id=%s&method=sq.order.detail.get",
							app_id);

			shenqiGetOrderListCall.setUrl(url);

			openapiReq.setSign(OpenapiService.generateMD5(openapiReq,
					AesUtil.decrypt(app_secret)));

			shenqiGetOrderListCall.setData(openapiReq);

			shenqiGetOrderListCall.callService();

			Logger.verifyEquals("0000", shenqiGetOrderListCall.getCode(), "校验code");
			Logger.verifyEquals("", shenqiGetOrderListCall.getMsg(),
					"校验message");

			Logger.verifyNotNull(shenqiGetOrderListCall.getContent(), "校验content");

		} catch (Exception e) {
			Logger.fail(e);
		}
	}
	
	@SuppressWarnings("static-access")
	@Test
	@Category({ P1.class })
	@TestCase
	public void Tc_sqgetorderdetail_020() {
		Logger.start(true, "openapi获取定金订单 指定orderid");
		try {
			
			long orderId = 1561280783L;

			long sellerId = 502060981;

			openApiGetOrderReq.setOrder_id(orderId);

			Application application = openApiWapper
					.selectApplicationBySellerId(sellerId).get(0);

			String app_id = application.getApp_id();

			AuthCode authCode = openApiWapper.selectAuthCodeByAppId(app_id)
					.get(0);

			openapiReq.setApp_id(app_id);

			String app_secret = application.getApp_secret();

			openapiReq.setSign_method("MD5");
			openapiReq.setAuth_code(authCode.getAuth_code());
			openapiReq.setTimestamp(YMTDateUtil.getSysTime());
			openapiReq.setNonce_str(TestDataManager.getRandomNum(31));
			openapiReq.setBiz_content(new FormatUtil()
					.beanToGSONString(openApiGetOrderReq));
			String url = String
					.format("http://apigateway.shop2cn.com/apigateway/v1?app_id=%s&method=sq.order.detail.get",
							app_id);

			shenqiGetOrderListCall.setUrl(url);

			openapiReq.setSign(OpenapiService.generateMD5(openapiReq,
					AesUtil.decrypt(app_secret)));

			shenqiGetOrderListCall.setData(openapiReq);

			shenqiGetOrderListCall.callService();

			Logger.verifyEquals("0000", shenqiGetOrderListCall.getCode(), 
					"校验code");
			Logger.verifyEquals("", shenqiGetOrderListCall.getMsg(),
					"校验message");

			Logger.verifyNotNull(shenqiGetOrderListCall.getContent(),
					"校验content");

			this.verifyPrice(shenqiGetOrderListCall.getorderdetailResponse()
					.getOrderInfo(), sellerId, 3, false);

		} catch (Exception e) {
			Logger.fail(e);
		}
	}
	
	@SuppressWarnings("static-access")
	@Test
	@Category({ P1.class })
	@TestCase
	public void Tc_sqgetorderdetail_021() {
		Logger.start(true, "openapi获取二次确认订单 指定orderid");
		try {
			
			long orderId = 1453670783L;

			long sellerId = 502060981;

			openApiGetOrderReq.setOrder_id(orderId);

			Application application = openApiWapper
					.selectApplicationBySellerId(sellerId).get(0);

			String app_id = application.getApp_id();

			AuthCode authCode = openApiWapper.selectAuthCodeByAppId(app_id)
					.get(0);

			openapiReq.setApp_id(app_id);

			String app_secret = application.getApp_secret();

			openapiReq.setSign_method("MD5");
			openapiReq.setAuth_code(authCode.getAuth_code());
			openapiReq.setTimestamp(YMTDateUtil.getSysTime());
			openapiReq.setNonce_str(TestDataManager.getRandomNum(31));
			openapiReq.setBiz_content(new FormatUtil()
					.beanToGSONString(openApiGetOrderReq));
			String url = String
					.format("http://apigateway.shop2cn.com/apigateway/v1?app_id=%s&method=sq.order.detail.get",
							app_id);

			shenqiGetOrderListCall.setUrl(url);

			openapiReq.setSign(OpenapiService.generateMD5(openapiReq,
					AesUtil.decrypt(app_secret)));

			shenqiGetOrderListCall.setData(openapiReq);

			shenqiGetOrderListCall.callService();

			Logger.verifyEquals("0000", shenqiGetOrderListCall.getCode(), 
					"校验code");
			Logger.verifyEquals("", shenqiGetOrderListCall.getMsg(),
					"校验message");

			Logger.verifyNotNull(shenqiGetOrderListCall.getContent(),
					"校验content");

			this.verifyPrice(shenqiGetOrderListCall.getorderdetailResponse()
					.getOrderInfo(), sellerId, 3, false);

		} catch (Exception e) {
			Logger.fail(e);
		}
	}
	
	@SuppressWarnings("static-access")
	@Test
	@Category({ P1.class })
	@TestCase
	public void Tc_sqgetorderdetail_022() {
		Logger.start(true, "openapi获取全款支付订单 指定orderid");
		try {
			
			long orderId = 13608188699L;

			long sellerId = 500002490L;

			openApiGetOrderReq.setOrder_id(orderId);

			Application application = openApiWapper
					.selectApplicationBySellerId(sellerId).get(0);

			String app_id = application.getApp_id();

			AuthCode authCode = openApiWapper.selectAuthCodeByAppId(app_id)
					.get(0);

			openapiReq.setApp_id(app_id);

			String app_secret = application.getApp_secret();

			openapiReq.setSign_method("MD5");
			openapiReq.setAuth_code(authCode.getAuth_code());
			openapiReq.setTimestamp(YMTDateUtil.getSysTime());
			openapiReq.setNonce_str(TestDataManager.getRandomNum(31));
			openapiReq.setBiz_content(new FormatUtil()
					.beanToGSONString(openApiGetOrderReq));
			String url = String
					.format("http://apigateway.shop2cn.com/apigateway/v1?app_id=%s&method=sq.order.detail.get",
							app_id);

			shenqiGetOrderListCall.setUrl(url);

			openapiReq.setSign(OpenapiService.generateMD5(openapiReq,
					AesUtil.decrypt(app_secret)));

			shenqiGetOrderListCall.setData(openapiReq);

			shenqiGetOrderListCall.callService();

			Logger.verifyEquals("0000", shenqiGetOrderListCall.getCode(), 
					"校验code");
			Logger.verifyEquals("", shenqiGetOrderListCall.getMsg(),
					"校验message");

			Logger.verifyNotNull(shenqiGetOrderListCall.getContent(),
					"校验content");

			this.verifyPrice(shenqiGetOrderListCall.getorderdetailResponse()
					.getOrderInfo(), sellerId, 3, false);

		} catch (Exception e) {
			Logger.fail(e);
		}
	}
	
	@SuppressWarnings("static-access")
	@Test
	@Category({ P1.class })
	@TestCase
	public void Tc_sqgetorderdetail_023() {
		Logger.start(true, "openapi获取订单分销员信息 指定orderid");
		try {
			
			long orderId = 14155596407L;

			long sellerId = 500002490;

			openApiGetOrderReq.setOrder_id(orderId);
			openApiGetOrderReq.setNeeds_distributor_info(true);

			Application application = openApiWapper
					.selectApplicationBySellerId(sellerId).get(0);

			String app_id = application.getApp_id();

			AuthCode authCode = openApiWapper.selectAuthCodeByAppId(app_id)
					.get(0);

			openapiReq.setApp_id(app_id);

			String app_secret = application.getApp_secret();

			openapiReq.setSign_method("MD5");
			openapiReq.setAuth_code(authCode.getAuth_code());
			openapiReq.setTimestamp(YMTDateUtil.getSysTime());
			openapiReq.setNonce_str(TestDataManager.getRandomNum(31));
			openapiReq.setBiz_content(new FormatUtil()
					.beanToGSONString(openApiGetOrderReq));
			String url = String
					.format("http://apigateway.shop2cn.com/apigateway/v1?app_id=%s&method=sq.order.detail.get",
							app_id);

			shenqiGetOrderListCall.setUrl(url);

			openapiReq.setSign(OpenapiService.generateMD5(openapiReq,
					AesUtil.decrypt(app_secret)));

			shenqiGetOrderListCall.setData(openapiReq);

			shenqiGetOrderListCall.callService();

			Logger.verifyEquals("0000", shenqiGetOrderListCall.getCode(), 
					"校验code");
			Logger.verifyEquals("", shenqiGetOrderListCall.getMsg(),
					"校验message");

			Logger.verifyNotNull(shenqiGetOrderListCall.getContent(),
					"校验content");

			this.verifyPrice(shenqiGetOrderListCall.getorderdetailResponse()
					.getOrderInfo(), sellerId, 3, false);

		} catch (Exception e) {
			Logger.fail(e);
		}
	}
	
	@SuppressWarnings("static-access")
	@Test
	@Category({P1.class})
	@TestCase
	@Ignore
	public void Tc_sqgetorderlist_STG() {
		Logger.start(true, "openapi获取订单乡情 stag");
		try {

			String app_id = "0Y6XVHaj7kjsoEcvGg";
			String app_secret = "5340AA34A5D6A154066F5074B31BA672149B88B399F6611450BB931952F3EE3277A049D2CAB92FF1E467219E19726988";
			String auth_code = "04MvSmEWQvF07g4U98uHsViKAJYlot5r";

			openapiReq.setApp_id(app_id);
			
			openApiGetOrderReq.setOrder_id(11877948699L);
			openApiGetOrderReq.setNeeds_delivery_info(true);

			openapiReq.setSign_method("MD5");
			openapiReq.setAuth_code(auth_code);
			openapiReq.setTimestamp(YMTDateUtil.getSysTime());
			openapiReq.setNonce_str(TestDataManager.getRandomNum(31));
			openapiReq.setBiz_content(new FormatUtil()
					.beanToGSONString(openApiGetOrderReq));

			String url = String
					.format("https://open.shop2cn.com/apigateway/v1?app_id=%s&method=sq.order.detail.get",
							app_id);

			shenqiGetOrderListCall.setUrl(url);

			openapiReq.setSign(OpenapiService.generateMD5(openapiReq,
					AesUtil.decrypt(app_secret)));

			shenqiGetOrderListCall.setData(openapiReq);
			shenqiGetOrderListCall.callService();

			Logger.verifyEquals("0000", shenqiGetOrderListCall.getCode(), "校验code");
			Logger.verifyEquals("null", shenqiGetOrderListCall.getMsg(),
					"校验message");

			Logger.verifyNotNull(shenqiGetOrderListCall.getContent(), "校验content");

		} catch (Exception e) {
			Logger.fail(e);
		}
	}
	
	public static void main(String[] args) {
		
		Ts_sqgetorderdetail test = new Ts_sqgetorderdetail();
		test.Tc_sqgetorderlist_STG();
	}
}
